﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace ISchool
{
    class labelDrawing:System.Windows.Forms.Label
    {
        public labelDrawing()
        { 
        }
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            //旋转显示文字
            Graphics g = e.Graphics;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            //平移Graphics对象到窗体中心
            g.TranslateTransform(this.Parent.Width / 2, this.Parent.Height / 2);
            //设置Graphics对象的输出角度
            g.RotateTransform(180);
            //设置文字填充颜色
            Brush brush = Brushes.DarkViolet;
            //旋转显示文字
            g.DrawString(this.Text, new Font("Lucida Console", 11f), brush, 0, 0);
            //恢复全局变换矩阵
            g.ResetTransform();

        }
    }
}
